<extend name="./Application/Admin/View/base.html" />
<block name="title"><title><?php echo C(APP_NAME);?>PC端管理</title></block>
<block name="stylesheets">
<link rel="stylesheet" href="__PUBLIC__/assets/css/jquery-ui.css" />
</block>
<block name="stylecss">
<style type='text/css'>
	.pages a,.pages span {
	    display:inline-block;
	    padding:5px 9px;
	    margin:0 1px;
	    border:1px solid #f0f0f0;
	}
	.pages a,.pages li {
	    display:inline-block;
	    list-style: none;
	    text-decoration:none; color:#58A0D3;
	}
	.pages a.first,.pages a.prev,.pages a.next,.pages a.end{
	    margin:0;
	}
	.pages a:hover{
	    border-color:#50A8E6;
	}
	.pages span.current{
	    background:#50A8E6;
	    color:#FFF;
	    font-weight:700;
	    border-color:#50A8E6;
	}
	.table input,select{
		border-radius:6px !important;
	}
</style>
</block>
<block name="smallmenu">
<ul class="breadcrumb">
	<li>
		<i class="ace-icon fa fa-home home-icon"></i>
		<a href="{:U('Index/index')}">主页</a>
	</li>

	<li class="active">评价音频</li>
</ul><!-- /.breadcrumb -->

<!-- #section:basics/content.searchbox -->
<div class="nav-search" id="nav-search"><button class="btn btn-xs btn-pink" onClick="delall()">批量删除</button></div>
<!-- /.nav-search -->
</block>

<block name="content">
	<div class="accordion" id="accordion2" style="border:1px solid #cccccc;padding:10px;border-radius:8px;margin-bottom:10px">
		<div class="accordion-group">
			<div class="accordion-heading">
				<a class="accordion-toggle collapsed" style="font-size:14px;" data-toggle="collapse" data-parent="#accordion2" href="#collapseSelect"> 请选择查询条件 </a>
			</div>
				<div id="collapseSelect" class="accordion-body collapse" style="height: 0px;padding-top:10px">
					<div class="accordion-inner">
						<form action="" id="form" name="selectUserForm" method="get">
							<input type="hidden" name="p" value="1">
							<table class="table" style="margin:0">
								<tr>
									<td>音频名称： <input name="audio_name" type="text" /></td>
									<td>专业： <select name="audio_major_id">
										<option value="">-请选择-</option>
										<option value="1">电吉他</option>
										<option value="2">爵士鼓</option>
										<option value="3">电贝司</option>
									</select></td>
									<td><button class="btn btn-sm btn-success" type="submit">查询</button></td>
								</tr>
							</table>

						</form>
					</div>
				</div>
		</div>
	</div>

	<input type="hidden" id="crontab-s" />

	<table id="sample-table-1" class="table table-striped table-bordered table-hover">
		<thead>
			<tr>
				<th class="center">编号</th>
			    <th class="center">音频名称</th>
				<th class="center">专业</th>
				<th class="center">等级</th>
				<th class="center">评论内容</th>
				<th class="center">评论时间</th>
				<th class="center">操作</th>
			</tr>
		</thead>

		<tbody>
			<foreach name="audio_arr" item="v">
			<tr style="text-align:center">
				<td class="center"><input type="checkbox" name="comment_id" value="{$v.comment_id}" id="cb{$v.comment_id}"><label for="cb{$v.comment_id}">&nbsp;&nbsp;{$v.comment_id}</label></td>
				<td class="center">{$v.audio_name}</td>
				<td>
					<if condition="$v.audio_major_id eq 1">
					电吉他
					<elseif condition="$v.audio_major_id eq 2" />
					爵士鼓
					<elseif condition="$v.audio_major_id eq 3" />
					电贝司
					</if>
				</td>
				<td>{$v.audio_level}级</td>
				<td>{$v.comment_content|cut_str=###,10}</td>
				<td>{$v.comment_date}</td>
				<td>
					<div class="hidden-sm hidden-xs btn-group">
						<div class="hidden-sm hidden-xs action-buttons">

							<a class="blue" style='cursor:pointer' title='查看评论信息' data-toggle="modal" data-target="#detailModal" onClick="dialog_show('{$v.comment_content}')" >
								<i class="ace-icon fa fa-search-plus bigger-130"></i>
							</a>
							&nbsp;&nbsp;
							<a class="red" style='cursor:pointer' onClick='dialog_see({$v.comment_id})' title='删除评论'>
								<i class="ace-icon fa fa-trash-o bigger-130"></i>
							</a>
						</div>
					</div>
				</td>
			</tr>
		    </foreach>
		</tbody>
	</table>
<div class="pages" style="float:right">{$page}</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">评论详情</h4>
            </div>
            <div class="modal-body">
            <p id="commentdetail" style="font-size: 18px;font-weight: bold;"></p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<!-- 删除大师模态框（Modal） -->
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true" data-backdrop="static">
   <div class="modal-dialog modal-sm">
	  <div class="modal-content">
		 <div class="modal-header">
			<button type="button" class="close" aria-hidden="true" onClick='modal_close()'>×</button>
			<h4 class="modal-title" id="myModalLabel">删除评论</h4>
		 </div>
		 <div class="modal-body" style='padding-bottom:0px'>
            <div class="row" style='margin-bottom:15px;margin-left:2px;font-size:14px'>
                确认是否删除该评论？
            </div>
		 </div>
		 <div class="modal-footer">
		 	<button data-bb-handler="button" type="button" class="btn btn-sm" onClick='modal_close()'>取消</button>
		 	<button type="button" class="btn btn-sm btn-primary" onClick='type_submit()'>确定</button>
		 </div>
	  </div><!-- /.modal-content -->
   </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</block>
<block name="scripts"></block>
<block name="jscript">
<script script="text/javascript">
    $(function(){
        $('#menu_comment').addClass('active open');
        $('#menu_commentaudio_list').addClass('active');
    });
</script>
<script script="text/javascript">
    function delall(){
    	var ids = '';
    	$("input[name='comment_id']:checked").each(function() { // 遍历选中的checkbox
    		if(ids == ''){
    			ids = $(this).val();
    		}else{
    			ids += ',' + $(this).val();
    		}
        });
        location.href = "__CONTROLLER__/comment_delall/ids/"+ids;
    }
    //模态框查看信息
    function dialog_see(obj) {
    	$('#crontab-s').val(obj);
		$('#myModal').modal('show');
	}
    //模态框查看信息
    function dialog_show(obj) {
    	$('#commentdetail').text(obj);
	}

	//模态框关闭
	function modal_close() {
		$('#myModal').modal('hide');
	}

	//删除分类
    function type_delete(obj) {
    	$('#myModal').modal('show');
    }

    //删除提交
    function type_submit() {
    	var crontab = $('#crontab-s').val();
    	$('#myModal').modal('hide');
    	location.href="__CONTROLLER__/comment_del/id/"+crontab;
    }
</script>
</block>